package leetcode.code1177;

import java.util.ArrayList;
import java.util.List;

import leetcode.IDebug;
import leetcode.helper.H;

public class Solution implements IDebug {

	public List<Boolean> canMakePaliQueries(String s, int[][] queries) {
		int[] sum = new int[s.length() + 1];
		for (int i = 1; i < sum.length; i++) {
			int index = s.charAt(i - 1) - 'a';
			sum[i] = sum[i - 1] ^ (1 << index);
		}

		List<Boolean> ans = new ArrayList<>();
		for (int i = 0; i < queries.length; i++) {
			ans.add(Integer.bitCount(sum[queries[i][1] + 1] ^ sum[queries[i][0]]) <= (1 + (queries[i][2] << 1)));
		}
		return ans;
	}

	@Override
	public void debug4() {
		this.canMakePaliQueries("abcda", H.str2array1("[[3,3,0],[1,2,0],[0,3,1],[0,3,2],[0,4,1]]"));

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		Solution so = new Solution();
		so.debug1();
		so.debug2();
		so.debug3();
		so.debug4();

	}

}
